package com.mercury.ec.module.air.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 机票订单审核状态
 *
 * @author hesx
 */
@Getter
@AllArgsConstructor
public enum AirOrderAuditStatusEnum {
    /**
     * 待审核
     */
    WAIT_AUDIT(0, "待审核"),
    /**
     * 同意
     */
    AGREE(1, "同意"),
    /**
     * 拒绝
     */
    REFUSE(2, "拒绝"),
    ;


    public static final String DICT_TYPE = "air_order_audit_status";

    /**
     * 值
     */
    private final Integer status;
    /**
     * 名称
     */
    private final String name;

    public static AirOrderAuditStatusEnum getByStatus(int status) {
        return ArrayUtil.firstMatch(o -> o.getStatus().equals(status), values());
    }

    public static boolean isWaitAudit(Integer status) {
        return ObjUtil.equal(WAIT_AUDIT.status, status);
    }

    public static boolean isAgree(Integer status) {
        return ObjUtil.equal(AGREE.status, status);
    }

    public static boolean isRefuse(Integer status) {
        return ObjUtil.equal(REFUSE.status, status);
    }
}
